﻿function pagesetup_null(){
    try{
        var RegWsh = new ActiveXObject("WScript.Shell");
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header","");
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer","");
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\Shrink_To_Fit","no");
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",0.75);
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",0.75);
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",0.70);
        RegWsh.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",0.70);
    }catch(e){}
}

//打印页面预览
function printpreview(){
    pagesetup_null();
    try{
        document.getElementById("wb").ExecWB(7, 1);
    }catch(e){
        alert("您的浏览器不支持此功能,请选择'文件'->'打印预览'");
    }
}

//打印
function prints(){
    pagesetup_null();
    try{
        document.getElementById("wb").ExecWB(6, 2);
        setTimeout('wb.ExecWB(45,1)', 1000);
    }catch(e){
        alert("您的浏览器不支持此功能");
    }
}